const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require("path");
const { HotModuleReplacementPlugin } = require("webpack");
module.exports = merge(common, {
    mode: 'development', // 不压缩代码,加快编译速度
    devtool: 'source-map', // 提供源码映射文件调试使用
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['vue-style-loader', 'css-loader'] // 使用vue-style-loader直接插入到style标签中
            },
            {
                test: /\.vue$/,
                options: {
                    vue: {
                        loaders: {
                            css: ExtractTextPlugin.extract({
                                fallback: 'vue-style-loader',
                                use: 'css-loader',
                                publicPath: "../"
                            }),
                        }
                    }
                }
            }
        ]
    },
    devServer: {
        contentBase: 'public', // path.resolve(__dirname, "dist"),
        progress: true, // 打包过程中的打包进度条
        compress: true,
        open: true,
        port: 3000
    },
    plugins: [
        new HotModuleReplacementPlugin()
    ]

})